package org.panda.tcmoc.domain;

public class ErrorFactory {
	private static ErrorFactory factory = null;

	private ErrorFactory() {
		super();
	}

	public static ErrorFactory getInstance() {
		if (factory == null) {
			factory = new ErrorFactory();
			return factory;
		} else {
			return factory;
		}
	}

	public Error getError(int errorCode) {
		switch (errorCode) {
		case Error.ERR_EXISTED:
			return new Error(Error.ERR_EXISTED, "Existed Record");
		case Error.ERR_SUCCESS:
			return new Error(Error.ERR_SUCCESS,"OK");
		default:
			return new Error(1, "no error found");
		}
	};
}
